//
// Created by ZLY on 2025/5/11.
//

#ifndef TEXT_LABEL_H
#define TEXT_LABEL_H
#include "../core/object_affiliate.h"


class TextLabel : public ObjectAffiliate {
protected:
    TTF_Text *ttf_text_ = nullptr;
    std::string font_path_ = "";
    int font_size_ = 16;

public:
    static TextLabel *addTextLabelChild(ObjectScreen *parent, const std::string &text, const std::string &font_path,
                                        int font_size, Anchor anchor = Anchor::CENTER);

    void render() override;
    void clean() override;
    void setFont(const std::string &font_path, int font_size);
    void setFontPath(std::string font_path);

    void setFontSize(int font_size);

    void setTTFText(std::string text) const ;
    std::string getTTFText() const {
        return ttf_text_->text;
    }

    int getFontSize() const {
        return font_size_;
    }

    std::string getFontPath() {
        return font_path_;
    }

private:
    void updateSize();
};


#endif //TEXT_LABEL_H
